package com.liuguang.testassert.security.getFilterIntercepter;

import lombok.extern.slf4j.Slf4j;
import org.springframework.security.access.ConfigAttribute;
import org.springframework.security.access.SecurityConfig;
import org.springframework.security.config.http.FilterInvocationSecurityMetadataSourceParser;
import org.springframework.security.web.FilterInvocation;
import org.springframework.security.web.access.intercept.FilterInvocationSecurityMetadataSource;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.Collection;

/**
 * @ClassName: MySecurityMetadasource
 * @Description：
 * @Author: wanghr
 * Date: 7:29 PM 2020/6/1
 * Version: 1.0
 */
@Slf4j
@Component
public class MySecurityMetadasource implements FilterInvocationSecurityMetadataSource {
    @Override
    public Collection<ConfigAttribute> getAttributes(Object object) throws IllegalArgumentException {
        FilterInvocation fi = (FilterInvocation)object;
        String requestUrl = fi.getRequestUrl();
        return null;
    }

    @Override
    public Collection<ConfigAttribute> getAllConfigAttributes() {
        ArrayList<ConfigAttribute> list = new ArrayList<>();
        list.add(new SecurityConfig("////sfsfsfsfs"));
        return list;
    }

    @Override
    public boolean supports(Class<?> clazz) {
        return true;
    }
}
